package descentFly
{
	import descentFly.away3D4.df_awaySpace;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	import flash.events.TimerEvent;
	import flash.geom.Matrix3D;
	import flash.utils.Timer;
	
	import org.osmf.events.TimeEvent;
	
	public class df_spaceObject extends EventDispatcher {
		public static const DISPOSE: String = 'DISPOSE';
		
		public function df_spaceObject(target:IEventDispatcher=null) {
			super(target);
			listenEvents();
		}
		
		protected static function createTimer(mls: int, doTimer: Function): Timer {
			var _timer: Timer = new Timer(mls);
			_timer.addEventListener(TimerEvent.TIMER, doTimer);
			return _timer;
		}
		
		protected static function oneTimer(mls: int, doTimer: Function): void {
			var _timer: Timer = new Timer(mls, 1);
			function v_doTimer(e: Event): void {
				_timer.removeEventListener(TimerEvent.TIMER_COMPLETE, v_doTimer);
				doTimer(e);
			}
			_timer.addEventListener(TimerEvent.TIMER_COMPLETE, v_doTimer);
			_timer.start();
		}
		
		public function dispose(): void {
			removeEvents();
			dispatchEvent(new Event(DISPOSE));
		}
		
		protected function get This(): df_spaceObject {
			return this;
		}
		
		protected function listenEvents(): void {
		}
		
		protected function removeEvents(): void {
		}
		
		public function callWaitEvent(event: String, func: Function): void {
			df_utils.callWaitEvent(this, event, func);
		}

		public function callWaitEvent2(noWait: Boolean, event: String, func: Function): void {
			df_utils.callWaitEvent2(this, noWait, event, func);
		}
	}
}